package com.jsu.forum.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.model.forum.pojo.Like;
import org.springframework.data.repository.query.Param;

@Mapper
public interface LikeMapper extends BaseMapper<Like> {
    @Delete("DELETE FROM passage_like WHERE passage_id = #{passageId} AND user_id = #{userId}")
    int deleteByPassageIdAndUserId(@Param("passageId") Integer passageId, @Param("userId") Integer userId);

    @Select("Select * FROM passage_like WHERE passage_id = #{passageId} AND user_id = #{userId}")
    Like selectByPassageIdAndUserId(@Param("passageId") Integer passageId, @Param("userId") Integer userId);
}
